﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GuessType.aspx.cs" Inherits="Jy123.Web.Manage.User.Guess.GuessType" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../../css/custom/jquery.ui.css" rel="stylesheet" type="text/css" />
    <link href="../../css/main.css" rel="stylesheet" type="text/css" />

    <script src="../../js/jquery.js" type="text/javascript"></script>

    <script src="../../js/jquery.ui.js" type="text/javascript"></script>

    <script src="../../js/main.js" type="text/javascript"></script>

    <script src="../../../JS/City.js" type="text/javascript"></script>
    
    
    <title>竞猜类别管理</title>
<script language="javascript" type="text/javascript">
function del(id)
{
    if(confirm('你确认删除此类别吗?'))
    {
        self.location="?Type=del&id="+id;
    }
}
function up(name,acc,id)
{
    if(confirm('你确定要保存修改吗?'))
    {
        self.location="?Type=up&Name="+name+"&Acc="+acc+"&id="+id;
    }
    window.location.reload();

}
function UpdateType(id,status)
{ 
    var html;
    var name;
    var acc;
    if(status==1)
    {
        html='<a class="btnsty cred" href="javascript:UpdateType('+id+',2)">保存</a>';
        $("#txtName"+id).removeAttr("readonly"); 
        $("#txtAcc"+id).removeAttr("readonly"); 
        $("#div"+id).html(html);
    }
    if(status==2)
    {
        name=$("#txtName"+id).val(); 
        acc=$("#txtAcc"+id).val(); 
        if(confirm('你确定要保存修改吗?'))
        {
             self.location="?Type=up&Name="+name+"&Acc="+acc+"&id="+id;
            //up(name,acc,id)
        }
//        html='<a class="btnsty" href="javascript:UpdateType('+id+',1)">编辑</a>';
//        $("#div"+id).html(html);
//        $("#txtName"+id).attr("readonly", "readonly");
//        $("#txtAcc"+id).attr("readonly", "readonly");
    }
}
</script>
</head>
<body>
    <h4>
        <a href="#"><span>竞猜类别管理</span></a></h4>
    <form id="form1" runat="server">
    <div class="register">
        <table width="100%" border="0" cellpadding="3" cellspacing="1">
            <tr>
                <td align="left" style=" width:200px;">类别名称</td>
                <td align="left" style=" width:678px;">
                    <asp:TextBox ID="txtTypeName" runat="server" MaxLength="100" CssClass="text"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="txtTypeName" ErrorMessage="类别名称不能为空"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td align="left" style=" width:200px;">类别说明</td>
                <td align="left" style=" width:678px;">
                    <asp:TextBox ID="txtTypeAccount" runat="server" MaxLength="500" TextMode="MultiLine" Width="300"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="txtTypeAccount" ErrorMessage="类别说明不能为空"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 200px">
                </td>
                <td align="left">
                    <asp:Button ID="btnAdd" runat="server" onclick="btnAdd_Click" Text="添加新类别"  CssClass="btnsty"/>
                </td>
            </tr>
        </table>
    </div>
        <ul></ul>
        <asp:Repeater runat="server" ID="Rpt_TypeList">
        <HeaderTemplate>
            <table class="tblist">
                <tr>
                    <th>
                        编号
                    </th>
                    <th>
                        类别名称
                    </th>
                    <th>
                        类别说明
                    </th>
                    <th align="center">
                        操作
                    </th>
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr id="<%#Eval("ID") %>">
                <td>
                    <%# Container.ItemIndex + 1 + pagesize * (cpage - 1)%>
                </td>
                <td>
                    <input type="text" id="txtName<%# Eval("ID")%>" value="<%# Eval("TypeName")%>" readonly="readonly" size="25" class="text"/>
                    
                </td>
                <td>
                    <textarea id="txtAcc<%# Eval("ID")%>" cols="45" rows="5" readonly="readonly"><%# Eval("TypeAccount")%></textarea>
                </td>
                <td>
                <div  id="div<%# Eval("ID")%>">
                <a class="btnsty" href="javascript:UpdateType(<%# Eval("ID")%>,1)">编辑</a>
                </div>
                <div>
                    <a class="btnsty cred" href="javascript:del(<%# Eval("ID")%>);">删除</a> 
                </div>
                </td>
            </tr>
            
        </ItemTemplate>
        <FooterTemplate>
         <tr>
               <%-- <td colspan="8" style="text-align: right;">
                    <% =string.Format("当前{0}/{1},共{2}条记录", cpage, count[1], count[0]) + PageString((int)count[1], cpage, "Guess.aspx?page=$num$")%>
                </td>--%>
            </tr>
            </table>
        </FooterTemplate>
    </asp:Repeater>
</div>
    </form>
    </body>
</html>

